$(document).ready(function()
{
	// 连接服务器
	var socket = io('http://lot.iqykj.com:2120');
	// 连接后登陆
	uid = "";
	// 用户登录后,告诉后台有用户登录
	socket.on('connect',function ()
	{
		socket.emit('login',uid);
	});
	// 后端推送来消息时,执行此方法
	socket.on('new_msg',function (msg)
	{
		var msg_data;
		var rule = /&quot;/g;
        var str_json = msg.replace(rule,'"');
        // 获取当前url值
        var url = window.location.href;
        // console.log(url);
            (function ($) {
                $.getUrlParam = function (name) {
                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                    var r = window.location.search.substr(1).match(reg);
                    if (r != null) return unescape(r[2]); return null;
                }
            })(jQuery);
            var xx = $.getUrlParam('page');
            var agid = $.getUrlParam('ag');
            var EUI = $.getUrlParam('eui');
            var numb = $.getUrlParam('num');
            var start = $('input[name=start]').val();
            var end = $('input[name=end]').val();
            var genre = $('input[name=genre]').val();
        $.ajax(
        {
        	type:"get",
        	url:"/admin/log/pages",
        	async:false,
        	data:{Jstr:str_json,page:xx,ag:agid,eui:EUI,num:numb,start:start,end:end,genre:genre},
        	dataType:"html",
        	success:function(msg){
				if(msg){
					$("#box").html(msg);
				}
			}
        });
	});
});